{extend name="sign/base"/}
{block name='title'}注册{/block}

{block name="main"}
<h3>注册账号</h3>
<form class="m-t ajax-form" role="form" action="{:url('Sign/register')}" method="post" data-error-callback="changeCode">
    <div class="form-group">
        <input type="text" class="form-control" name="username" placeholder="昵称" autofocus="on" required="">
    </div>
    <div class="form-group">
        <input type="email" class="form-control" name="email" placeholder="Email" required="">
    </div>
    <div class="form-group">
        <input type="password" class="form-control" id="password" name="password" placeholder="密码" required="">
    </div>
    <div class="form-group">
        <input type="password" class="form-control" name="repassword" placeholder="确认密码" required="">
    </div>
    <div class="form-group">
        <input type="text" class="form-control" name="code" autocomplete="off" placeholder="验证码" required="">
        <div><img id="code" src="{:captcha_src()}" alt="captcha" onclick="this.src='{:captcha_src()}'"></div>
    </div>
    <button type="submit" class="btn btn-primary block full-width m-b">注册</button>

    <p class="text-muted text-center"><small>已有账号</small></p>
    <a class="btn btn-sm btn-white btn-block" href="{:url('Sign/index')}">登录</a>
</form>
{/block}

{block name="js"}
<script>
    //额外规则
    var rules = {
        rules: {
            password: {
                minlength: 6,
                maxlength: 12,
            },
            repassword: {
                required: true,
                equalTo: '#password',
            }
        }
    };

</script>
{/block}